package org.example.DesignPatterns.Mediator;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: farprt
 * @create: 2022-09-24 08:53
 **/
public abstract class ChatRoom {

    protected String name;
    protected List<User> users=new ArrayList<>();

    public ChatRoom(String name){
        this.name=name;
    }

    protected void register(User user){
        this.users.add(user);
    }

    protected void deregister(User user){
        this.users.remove(user);
    }

    protected abstract void sendMsg(User from,User to,String msg);

    protected abstract String processMsg(User from,User to,String msg);

}